﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;

namespace IAPM_GPC_dll
{
    class MySqlConnect
    {
        #region champs statiques

        public static MySqlConnection maConnexion = new MySqlConnection();
        public static MySqlCommand maCommandeSpecialRequete = new MySqlCommand();
        public static MySqlDataAdapter monRemplisseur = new MySqlDataAdapter();
        public static DataSet monJeuDeDonnees = new DataSet();
        public static string maRequete;
        public static string maChaine = "Server=localhost;Databaseppe2_iapm_tp_groupe;Uid=root;";

        #endregion

        #region méthodes Connect

        public static void seConnecter(string bdd)
        {
            maConnexion.ConnectionString = maChaine;
            maConnexion.Open();
            monJeuDeDonnees = new DataSet(bdd);
            monJeuDeDonnees.Clear();
            maCommandeSpecialRequete.CommandType = CommandType.Text;
            maCommandeSpecialRequete.Connection = maConnexion;
        }

        public static void seDeconnecter()
        {
            maConnexion.Close();
        }

        #endregion
    }
}
